
    function setCookie(key, val, expires, path = "/") {
        if (expires) {
            var date = new Date()
            date.setSeconds(date.getSeconds() + expires);
            document.cookie = key + "=" + val + "; expires=" + date.toUTCString() + "; path=" + path
        } else {
            document.cookie = key + "=" + val + "; path=" + path
        }
    }


    function getCookie(key) {
        var cookie = document.cookie
        if (cookie) {
            var list = cookie.split("; ")
            for (var i = 0; i < list.length; i++) {
                var item = list[i]
                var name = item.split("=")[0]
                var val = item.split("=")[1]
                if (name === key) {
                    return val
                }
            }
        }
        return ''
    }


    function delCookie(key) {
        setCookie(key, "", -1)
    }



